import { createRequest } from '/@/api/service';
const module = 'ib/archive/v1/ArchiveChangeBorrowApi/';

/**
 * @function 借用归还——列表查询
 * @param data
 * @param header
 * @returns
 */
function QUERY_CHANGE_BORROW_LIST(
  data: ArchiveChangeBorrowApi.QueryChangeBorrowListReq,
  header: object = {},
): Promise<ArchiveChangeBorrowApi.QueryChangeBorrowListResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}queryChangeBorrowList`,
    data,
    header,
    'POST',
  );
}

/**
 * @function 借用归还——新增借用
 * @param data
 * @param header
 * @returns
 */
function INSERT_CHANGE_BORROW(
  data: ArchiveChangeBorrowApi.InsertChangeBorrowReq,
  header: object = {},
): Promise<ArchiveChangeBorrowApi.InsertChangeBorrowResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}insertChangeBorrow`,
    data,
    header,
    'POST',
  );
}

/**
 * @function 借用归还—查看详情
 * @param data
 * @param header
 * @returns
 */
function QUERY_CHANGE_BORROW_DETAIL(
  data: ArchiveChangeBorrowApi.QueryChangeBorrowDetailReq,
  header: object = {},
): Promise<ArchiveChangeBorrowApi.QueryChangeBorrowDetailResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}queryChangeBorrowDetail`,
    data,
    header,
    'POST',
  );
}

/**
 * @function 借用归还—确认归还
 * @param data
 * @param header
 * @returns
 */
function RETURN_CHANGE_BORROW_DETAIL(
  data: ArchiveChangeBorrowApi.ReturnChangeBorrowReq,
  header: object = {},
): Promise<ArchiveChangeBorrowApi.ReturnChangeBorrowResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}returnChangeBorrow`,
    data,
    header,
    'POST',
  );
}

/**
 * @function 借用归还——借用审批
 * @param data
 * @param header
 * @returns
 */
function APPROVAL_CHANGE_BORROW(
  data: ArchiveChangeBorrowApi.ApprovalChangeBorrowReq,
  header: object = {},
): Promise<ArchiveChangeBorrowApi.ApprovalChangeBorrowResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}approvalChangeBorrow`,
    data,
    header,
    'POST',
  );
}

export {
  QUERY_CHANGE_BORROW_LIST,
  INSERT_CHANGE_BORROW,
  QUERY_CHANGE_BORROW_DETAIL,
  RETURN_CHANGE_BORROW_DETAIL,
  APPROVAL_CHANGE_BORROW,
};
